﻿@using PagedList
@using PagedList.Mvc
@model PagedList<Great_Eggspectations.DAL.Partner>

<table class="table">
    <tr>
        <th>Name</th>
        <th>Address</th>
        <th>Balance</th>
        <th></th>
    </tr>

    @foreach (var item in Model.OrderBy(p => p.Name))
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @(string.Format("{0}, {1}, {2} {3}", item.Address, item.City, item.State, item.ZIP))
            </td>
            <td>
                @item.Balance.ToString("C")
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", "Partner", new { id = item.Id }, new { }) |
                @Html.ActionLink("Details", "Details", "Partner", new { id = item.Id }, new { }) |
                @Html.ActionLink("Delete", "Delete", "Partner", new { id = item.Id }, new { }) |
                @Html.ActionLink("View Transactions", "Index", "Transaction", new { PartnerId = item.Id }, new { })
            </td>
        </tr>
    }

</table>

<div class="col-sm-12">
    <div class="center">
        @Html.PagedListPager(Model, page => Url.Action("Index", new { page, pageSize = Model.PageSize }))
        Showing @Model.FirstItemOnPage to @Model.LastItemOnPage of @Model.TotalItemCount Partners
    </div>
</div>
<br />